<?php
require_once 'pages/TMSItemCreationPage.inc';
require_once 'models/TMSTypesModel.inc';

class TMSAdminGlossaryCreatePage extends TMSItemCreationPage {
/**
 * @var TMSTypesModel
 */	
	protected $_ioc_types_model_;
	
	private $_type_;
	
	public function Handle(THttpRequest $request){
		if ($request->class){
			$this->Model->Classname = $request->class;
			if ($this->TypesModel)
				$this->_type_ = $this->TypesModel->GetItem($request->class);
		}
		parent::Handle($request);
	}		
	
	public function __get($nm){
		switch ($nm){
			case 'Path':{
				return array($this->service->GlossaryUrl($this->request->class,'list')=>$this->_type_->Name);
			}break;
			case 'ListUrl':return $this->service->GlossaryUrl($this->request->class,'list');break;
			default:return parent::__get($nm);break;
		}
	}		
		
	protected function processUrlParameters(array $parameters){
		if (!isset($parameters['class']) && ($this->request instanceof THttpRequest))
			$parameters['class'] = $this->request->class;
		return parent::processUrlParameters($parameters);
	}
}